package com.cat.orm.core.base;

/**
 * 简单数据pojo对象,id映射对应data存储.
 * 数据库主键: id
 * 数据库值: data
 * @author Jeremy Feng
 * @date 2024/10/19 08:40
 */
public class SimpleBasePo extends BasePo{

    public static final String PROP_ID = "id";
    public static final String PROP_DATA = "data";

    /** 所有列字段数组*/
    public static final String[] PROP_ALL = new String[] {
            PROP_ID,
            PROP_DATA,
    };

    /** 所有主键索引字段数组*/
    public static final String[] KEY_AND_INDEX_COLUMN = new String[] {
            PROP_ID,
    };

    /** 所有索引字段数组*/
    public static final String[] INDEX_ALL = new String[] {
    };


    /** 主键id*/
    protected long id;
    /** 数据*/
    protected byte[] data;

    public SimpleBasePo(){
    }

    /** 活动类型id **/
    public long getId(){
        return this.id;
    }

    public void setId(long id){
        this.id = id;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    @Override
    public String[] props() {
        return PROP_ALL;
    }

    @Override
    public Object[] propValues() {
        return new Object[] {
                getId(),
                getData(),
        };
    }

    @Override
    public Object key() {
        return getId();
    }

    @Override
    public String keyColumn() {
        return PROP_ID;
    }

    @Override
    public String[] keyAndIndexColumn() {
        return KEY_AND_INDEX_COLUMN;
    }

    @Override
    public Object[] keyAndIndexValues() {
        return new Object[] {
                getId(),
        };
    }

    @Override
    public String[] indexColumn() {
        return INDEX_ALL;
    }

    @Override
    public String[] indexValues() {
        return new String[] {
        };
    }

    @Override
    public String cacheId() {
        return String.valueOf(getId());
    }

}
